#include <iostream>
#include <iomanip>
#include "Core/numlib.h"
#include "Embedded/EmbeddedGrid.h"
#include "../example/common/RoundedStar.h"

const int Dim = SpaceDim;
using rVec = Vec<Real, Dim>;
template class Tensor<Real, Dim>;
template class Tensor<int, Dim>;

int main()
{
  reset_dbglevel(1);
  std::cout << "SpaceDim = " << SpaceDim << std::endl;
  std::cout << "============================================================================\n";

  const Real geoTol = 1e-12;
  const int N = 40;
  rVec translate(0.5);
  RectDomain<Dim> rectdomain(Box<Dim>(0, N-1), 1.0 / N, CellCentered, 2);
  RoundedStar geoObj(0.25, 0.05, 6);
#if DIM == 2
  EmbeddedGrid<Dim> emGrid(rectdomain, [&](rVec q, rVec &closest, rVec &normal, bool &contained, Real tol) {
    q = q - translate;
    geoObj.check(q, closest, normal, contained, tol);
    closest = closest + translate;
    normal = -normal;
    contained = !contained;
  }, true, 0.1, geoTol);
#ifndef NDEBUG
    emGrid.dump(tmpos);
#endif
#endif
  std::cout << std::endl;
  return 0;
}
